<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<title>铁水联运信息核查系统--会员账号管理</title>
	<link rel="shortcut icon" href="${mainDomain}/statics/images/favicon.ico">
    <link rel="stylesheet" href="${mainDomain}/statics/css/front/amazeui.min.css"/>
  	<link rel="stylesheet" href="${mainDomain}/statics/css/front/admin.css">
    <link rel="stylesheet" media="screen" href="${mainDomain}/statics/css/front/bootstrap.min.css" >
    <link rel="stylesheet" media="screen" href="${mainDomain}/statics/css/front/bootstrap-datetimepicker.min.css" >
    <script type="text/javascript">
        var mainDomain = "${mainDomain}";
		var miscDomain = '${mainDomain}';
    </script>
</head>
<body>
<#include "common/memberheader.ftl" />
<div class="am-cf admin-main">
	<#include "common/memberleft.ftl" />
	<!-- content start -->
<div class="admin-content">
    <div class="admin-content-body">
        <div class="am-cf am-padding am-padding-bottom-0">
            <div class="am-fl am-cf">
                <strong class="am-text-primary am-text-lg">会员信息</strong> /
                <small>账号管理</small>
            </div>
        </div>

        <hr>


        <form id="my-form" class="am-form" action="javascript:;" method="post" data-am-validator>
            <div class="am-g">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    旧密码
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group">
                    <input type="password" name="oldpwd" class="am-input-sm" data-validation-message="请输入旧密码" required>
                </div>
                <div class="am-hide-sm-only am-u-md-6 am-text-danger" id="qyqc_tips">＊ 必填</div>
            </div>
			<div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    新密码
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-u-end am-form-group">
                    <input type="password" id="doc-vld-pwd-1" class="am-input-sm" data-validation-message="请输入新密码" required>
                </div>
				<div class="am-hide-sm-only am-u-md-6 am-text-danger" id="qyqc_tips">＊ 必填</div>
            </div>
			<div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    再次输入密码
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-u-end am-form-group">
                    <input type="password" name="newpwd" id="doc-vld-pwd-2" class="am-input-sm" data-equal-to="#doc-vld-pwd-1" data-validation-message="两次输入的密码不一致" required>
                </div>
				<div class="am-hide-sm-only am-u-md-6 am-text-danger" id="doc-vld-pwd-2_tips">＊ 必填</div>
            </div>
			
            <div class="am-margin">
                <button type="sumbit" id="saveButton" class="am-btn am-btn-primary am-btn-xs">提交保存</button>
            </div>
        </form>

    </div>
</div>
<!-- content end -->

</div>
</div>
<#include "common/memberfooter.ftl" />
</div>
	<script type="text/javascript" src="${mainDomain}/statics/js/front/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" src="${mainDomain}/statics/js/front/amazeui.min.js"></script>
	<script type="text/javascript" src="${mainDomain}/statics/js/front/formvalidation.js"></script>
	<script>
	$('#my-form').validator(
    {
        validate: function (validity) {
        	if ($(validity.field).is('#doc-vld-pwd-2')) {
        		if($.trim($("#doc-vld-pwd-2").val())!=$.trim($("#doc-vld-pwd-1").val()))
                	{
                		validity.valid = false;
                		$('#doc-vld-pwd-2_tips').html("两次密码输入不一致");
                	}
                	else if($.trim($("#doc-vld-pwd-2").val()).length>20)
                	{
                		$('#doc-vld-pwd-2_tips').html("密码只能小于20位");
                	}
                	else
				    {
				    	validity.valid = true;
                        $('#doc-vld-pwd-2_tips').html("");
				    }
        	}
        },
        
        submit: function() {
        	if(this.isFormValid()){
        	$("#saveButton").attr("disabled","disabled");
        	
        	$.ajax( {  
	        type : 'POST',  
	        url : '/member/passwordedit',  
	        data : $('#my-form').serialize(),  
	        success : function(data) {  
	        	var msg = data.message;
	        	if(msg==1)
        		{
	        		alert('修改成功');
	        		$("#saveButton").removeAttr("disabled");
        		}
	        	else
        		{
		        	alert(msg);
		        	$("#saveButton").removeAttr("disabled");
        		} 
	        },  
	        error : function(data) {  
	          alert("修改失败");
	          $("#saveButton").removeAttr("disabled");  
	        }  
	      });
        }
        }
    })
	</script>
</body>
</html>
